package com.hebeu.gfh.service.impl;

import com.hebeu.gfh.mapper.clubFollowMapper;
import com.hebeu.gfh.pojo.po.ClubFollow;
import com.hebeu.gfh.pojo.po.Clubs;
import com.hebeu.gfh.service.clubFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 刘剑利
 * @Version: v1.0
 */
@Service("/clubFollowService")
public class clubFollowServiceImpl implements clubFollowService {
    @Autowired
    clubFollowMapper clubFollowMapper;

    @Override
    public int findClubNumByuserId(int userId) {
        int num = clubFollowMapper.findClubNumByuserId(userId);
        return num;
    }

    @Override
    public List<Clubs> findClubByuserId(int userId) {
        List<Clubs> clubsList = clubFollowMapper.findClubByuserId(userId);
        return clubsList;
    }

    @Override
    public int findFollowByuserIdAndClubId(ClubFollow clubFollow) {
        ClubFollow clubFollow1 = clubFollowMapper.findFollowByuserIdAndClubId(clubFollow);
        if(clubFollow1!=null)
        return 1;
        else
            return 0;
    }

    @Override
    public void addFollow(ClubFollow clubFollow) {
        clubFollowMapper.addFollow(clubFollow);
    }

    @Override
    public void deleteFollow(ClubFollow clubFollow) {
        clubFollowMapper.deleteFollow(clubFollow);
    }
}
